package com.pdwl.controller;

import com.pdwl.common.dtos.ResponseResult;
import com.pdwl.common.vo.AreaSimpleVo;
import com.pdwl.service.AreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description:
 * @Author: TLB
 * @Date: 2023/1/12 17:36
 */
@RestController
@RequestMapping("/api/area")
@Api(tags = "地区信息管理")
public class AreaController {

    @Autowired
    private AreaService areaService;

    /**
     * 根据父级行政id查询简单地区信息
     *
     * @param parentId
     * @return
     */
    @GetMapping("/simple")
    @ApiOperation("根据父级行政id查询简单地区信息")
    @ApiImplicitParam(value = "父级行政id",
            name = "parentId",
            required = true,
            example = "1654")
    public ResponseResult<List<AreaSimpleVo>> listSimple(Integer parentId) {

        return areaService.listSimple(parentId);
    }
}
